package c.x.jy.service.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import c.x.jy.common.utils.PageUtils;
import c.x.jy.common.utils.Query;

import c.x.jy.dao.dao.CmsArticleDataDao;
import c.x.jy.dao.entity.CmsArticleDataEntity;
import c.x.jy.service.service.CmsArticleDataService;
import org.apache.commons.lang3.StringUtils;


@Service("cmsArticleDataService")
public class CmsArticleDataServiceImpl extends ServiceImpl<CmsArticleDataDao, CmsArticleDataEntity> implements CmsArticleDataService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        	QueryWrapper<CmsArticleDataEntity> query= 	 new QueryWrapper<CmsArticleDataEntity>() ;
    	if(params.get("searchKey")!=null&&params.get("searchValue")!=null&&!StringUtils.isEmpty(params.get("searchKey").toString())&&!StringUtils.isEmpty(params.get("searchValue").toString()))
    	    query.eq(  params.get("searchKey").toString(), params.get("searchValue"));
        if(params.get("businessId")!=null) 	query.eq("business_id", params.get("businessId"));
        IPage<CmsArticleDataEntity> page = this.page(
                new Query<CmsArticleDataEntity>().getPage(params),
                 query
        );

        return new PageUtils(page);
    }

}
